import * as React from 'react'
import * as ReactMarkdown from 'react-markdown'
import 'github-markdown-css/github-markdown.css'
class ReactMarkdownPreview extends React.Component<any> {
  render () {
    const markdownSrc = this.props.source || ''
    const videoTag = markdownSrc.includes('<video')
    const isEscapeHtml = !videoTag

    return (<ReactMarkdown className='markdown-body markdown-init'
                     source={this.props.source} 
                     escapeHtml={isEscapeHtml}/>
    )
  }
}

export default ReactMarkdownPreview